/**
 * Created by zhuyufeng on 2016/1/2.
 */
//下拉框选项
var classStore = Ext.create('Ext.data.Store', {
	fields: ['class'],
	data : [{"class":"A"},{"class":"B"},{"class":"C"},{"class":"D"}]
});
//下拉框
var classes = new Ext.form.ComboBox({
	store: classStore,
	valueField: 'class',
	tpl: Ext.create('Ext.XTemplate',      //下拉框内容
		'<tpl for=".">',
		'<div class="x-boundlist-item">{class}</div>',
		'</tpl>'
	),
	displayTpl: Ext.create('Ext.XTemplate', 		// 输入框显示内容
		'<tpl for=".">',
		'{class}',
		'</tpl>'
	)
});
Ext.define('healthModel', {
	extend: 'Ext.data.Model',
	fields: [ 'num','class']
});
var healthStore = Ext.create('Ext.data.Store', {
	model: 'healthModel',
	autoLoad: true,
	pageSize: 10,
	proxy: {
		type: 'ajax',
		url : './json/health',
		reader: {
			type: 'json',
			root: 'rows',
			totalProperty: 'total'
		}
	}
});
var health = Ext.create('Ext.grid.Panel', {
	region:'center',
	split:false,
	border:true,
	collapsible:false,
	activeTab:0,
	autoHeight:true,
	title:'发布公告',
	store: healthStore,
	height:280,
	forceFit:true,
	selType:'cellmodel',
	columns: [
		{text: '寝室号',width: 100,dataIndex: 'num'},
		{text: '卫生等级',width: 150,dataIndex: 'class',editor:classes}
	],
	plugins:[
		Ext.create('Ext.grid.plugin.CellEditing', {
			clicksToEdit: 1
		})
	],
	dockedItems:[{
		xtype:'pagingtoolbar',
		store:nobackStore,
		dock:'bottom',
		displayInfo:true,
		displayMsg:'第{0}条到第{1}条,一共{2}条',
		emptyMsg:'没有记录'
	}],
	bbar:[{
		xtype:'button',
		text:'发布',
		buttonAlign:'center',
		handler:function(){}
	}]
});